Octagon- An octagon got it's name by having eight edges. Another word for that is oct, so it's name is octagon.
Hexagon- A hexagon got it's name by the word hex which equals six edges, just like a hexagon.
Pentagon- A pentagon got it's name by having five edges which equals pent.
Square- A square got it's name by having four equal edges so it's a square.
Triangle- A triangle got it's name by having three edges which equals tri, so it's a triangle because it has an angle.